// https://mp.weixin.qq.com/s/nq3bxIbyFJPqs-hXRmfqnQ
interface admin {
  name: string;
  privileges: string[];
}
interface Employee {
  name: string;
  startDate: Date;
}

type unKnownTypes = Employee | admin;

function printEmployeeInfo(employee: unKnownTypes): void {
  // 通过使用in关键字，判断传入的遍历的类型，类型是联合类型，会有多种情况
  if ("privileges" in employee) {
    console.log(employee.privileges);
  }
  if ("startDate" in employee) {
    console.log(employee.startDate);
  }
}
export {}
